package com.example.feifei.mvp.persenter;

import com.example.feifei.mvp.model.UserBean;
import com.example.feifei.mvp.view.LoginView;
import com.example.feifei.net.CallBackSubscriber;
import com.example.feifei.net.MySubscriber;

/**
 * 业务实现类
 * Created by Administrator on 2018\9\17 0017.
 */

public class LoginPresenterCompl implements LoginPresenter{

    private LoginView loginView;
    private UserBean userBean;
    MySubscriber loader;

    public LoginPresenterCompl(LoginView loginView) {
        this.loginView = loginView;
        initUser();
        loader = new MySubscriber();
    }

    @Override
    public void doLogin(String userName, String passWord) {
        loader.getRxNetString().subscribe(new CallBackSubscriber<String>(){
            @Override
            public void onNext(String s) {
                loginView.doLogin(s);
            }
        });

    }

    @Override
    public void deCancel() {
        loginView.cancel();
    }

    private void initUser(){
        userBean = new UserBean("userName","password");
    }
}
